package com.jiuwu.note.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jiuwu.note.dao.ShopEventDao;
import com.jiuwu.note.po.ShopDetailsPO;
import com.jiuwu.note.po.ShopEventPO;

@Service
public class ShopEventService {
	
	
	@Autowired
	ShopEventDao shopEventDao;
	
	public List<ShopEventPO> getAllEvent(){
		return shopEventDao.getAllEvent();
	}
	
	/**
	 * 查询所有购买商品
	 * @param shopEventId 当前购物事件id
	 * @return ShopDetailsPO列表
	 */
	public List<ShopDetailsPO> getShopDetailsByEventId(int shopEventId){
		return shopEventDao.getShopDetailsByEventId(shopEventId);
	}
	
	
	public List<ShopDetailsPO> getShopDetailsByEventIdAndShopers(int shopEventId,int shoperId){
		return shopEventDao.getShopDetailsByEventIdAndShoper(shopEventId, shoperId);
	}
	
	/**
	 * 查询所有购物事件
	 * @param id 得到购物事件
	 * @return
	 */
	public ShopEventPO getShopEventById(int id) {
		return shopEventDao.getShopEventById(id);
	}
	
	public int addEvent(ShopEventPO po) {
		return shopEventDao.addEvent(po);
	}
	
	public int addDetails(ShopDetailsPO details) {
		return shopEventDao.addDetails(details);
	}

}
